import {ElMessage} from "element-plus";
import {ref, computed} from 'vue'
import {defineStore} from 'pinia'

import {getUserAPI} from "../apis/user.js";

export const useUserStore = defineStore('user', () => {
  const user = ref({})

  const doubleCount = computed(() => count.value * 2)

  function increment() {
    count.value++
  }

    return {
      user,
      doubleCount,
      increment
    }
  },
  {
    persist: {
      key: "myKey",
      storage: localStorage,
      // paths: ["token", "loginUserInfo"],
      serializer: {
        deserialize: JSON.parse,
        serialize: JSON.stringify,
      },
    }
  }
)
